using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class forums_controls_misc_userlist : System.Web.UI.UserControl
{
    private int CurrentPage
    {
        get
        {
            int page;
            if (Helpers.QueryStringHelper.TryGetInt32("page", out page))
            {
                return page;
            }
            else
            {
                return 1;
            }
        }
    }
    public void Refresh()
    {
        DAL.DataManagerPage<DAL.User> myItems = DAL.Users.GetAllUsersByPage(CurrentPage);
        Pager1.CurrentPage = CurrentPage;
        Pager1.TotalPages = myItems.Pages;
        Pager1.UrlFormat = "~/forums/members.aspx?page={0}";

        Pager2.CurrentPage = Pager1.CurrentPage;
        Pager2.TotalPages = Pager1.TotalPages;
        Pager2.UrlFormat = Pager1.UrlFormat;

        gridUsers.DataSource = myItems.Items;
        gridUsers.DataBind();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            Refresh();
        }
        Page.Title = "FSTDT Forums: Members";
    }
}
